package com.example.demo.jucConcurrent.LockSupport详解;


public class WaitAndNotifyDemo {
    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        myThread.start();
        //线程瞬眠3s
        try {
            Thread.sleep(3000);
             synchronized (myThread){
                 try {
                     System.out.println("before wait");
                     //阻塞主线程
                     myThread.wait();
                     System.out.println("after wait");
                 } catch (InterruptedException e) {
                     e.printStackTrace();
                 }
             }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}


